package com.tanhua.manage.interceptor;

import com.tanhua.manage.domain.Admin;

public class AdminHolder {

    private static ThreadLocal<Admin> admins = new ThreadLocal<>();

    //向当前线程存储数据
    public static void set(Admin adimin){
        admins.set(adimin);
    }

    //从当前线程中获取数据
    public static Admin get(){
        return admins.get();
    }

    public static void remove(){
        admins.remove();
    }

    //获取当前用户的id
    public static Long getUserId(){
        return admins.get().getId();
    }
}
